The Dreamweaver JavaScript API > Quick Tag Editor functions > dom.wrapTag()

 

dom.wrapTag()

Availability

Dreamweaver 3.0

Description

Wraps the specified tag around the current selection. If the selection is unbalanced, Dreamweaver reports an error.

Arguments

startTag

startTag is the source associated with the opening tag.

Returns

Nothing.

Enabler

None.

Example

The following code wraps a link around the current selection:

var theDOM = dw.getDocumentDOM();
var theSel = theDOM.getSelectedNode();
if (theSel.nodeType = = Node.TEXT_NODE){
	theDOM.wrapTag('<a href="foo.html">');
}